#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  simple.py
#       Author @  Huoty
#  Create date @  2016-01-06 14:53:01
#  Description @  
# *************************************************************

from apscheduler.schedulers.background import BackgroundScheduler
import pynotify
import time

def my_job(name, msg):
    title_notify = "测试"
    msg_notify = name + ' say: "' + msg + '"'
    pynotify.init("test")
    rnotify = pynotify.Notification(title_notify, msg_notify)
    rnotify.show()

# Script starts from here

if __name__ == "__main__":
    sched = BackgroundScheduler()
    sched.add_job(my_job, "interval", seconds=2, args=["Huoty", "hello world."])
    sched.add_job(my_job, "interval", seconds=5, args=["Guest", "hi, hahahha."])
    sched.start()

    try:
        while True:
            time.sleep(2)
    except Exception, e:
        print e
        sched.shutdown()
